<?php 
require_once '../common/common.inc.php';

$location = isset($_REQUEST["location"]) ? $_REQUEST["location"] : null;
$service = isset($_REQUEST["service"]) ? $_REQUEST["service"] : null;

conn();

$sql = "";
$sql .= "SELECT ID, NAME, START, END ";
$sql .= "FROM SCHEDULES ";
$sql .= "WHERE LOCATION_CODE = '$location' ";
$sql .= "AND SERVICE_CODE = '$service' ";
$result = mysql_query($sql);
if (!$result) {die('Could not exec query: ' . mysql_error());}
$numRows = mysql_num_rows($result);

close();

function dropdownTime($name) {
  $str = "";  
  $str .= "<select id=\"$name\" name=\"$name\" class=\"required\" >";
    $str .= "<option>07:00</option>";
    $str .= "<option>08:00</option>";
    $str .= "<option>09:00</option>";
    $str .= "<option>10:00</option>";
    $str .= "<option>11:00</option>";
    $str .= "<option>12:00</option>";
    $str .= "<option>13:00</option>";
    $str .= "<option>14:00</option>";
    $str .= "<option>15:00</option>";
    $str .= "<option>16:00</option>";
    $str .= "<option>17:00</option>";
    $str .= "<option>18:00</option>";
    $str .= "<option>19:00</option>";
  $str .= "</select>";

  return $str;   
}

?>

<table id="schedule-overview" border="1">
<?php 
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  $id = $row["ID"];
  $name = $row["NAME"];
  $start = $row["START"];
  $end = $row["END"];
?>
  <tr>
    <td><?php echo $id; ?></td>
    <td><?php echo $name; ?></td>
    <td><?php echo $start; ?></td>
    <td><?php echo $end; ?></td>
  </tr>
<?php 
} 
?>
</table>



<table id="schedule-add" border="1">
  <tr>
    <td>Begin:</td>
    <td><?php echo dropdownTime("start"); ?></td>
  </tr>
  <tr>
    <td>Einde:</td>
    <td><?php echo dropdownTime("einde"); ?></td>
  </tr>
</table>








